| Conditions | 1 | 
| Paths | 6 | 
| Total Lines | 41 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 3 | ||
| Bugs | 0 | Features | 0 | 
| 1 | /**  | 
            ||
| 12 |     function(state) { | 
            ||
| 13 |       this.visible = function(items, func, currentElement, sortFunc) { | 
            ||
| 14 | let visibles = [];  | 
            ||
| 15 |         for (let i in items) { | 
            ||
| 16 | // if it is an array, we need to extract the item from the index  | 
            ||
| 17 | let item = Array.isArray(items) ? items[i] : i;  | 
            ||
| 18 |           if (func(item, currentElement)) { | 
            ||
| 19 | visibles.push(item);  | 
            ||
| 20 | }  | 
            ||
| 21 | }  | 
            ||
| 22 |         if(sortFunc){ | 
            ||
| 23 | visibles.sort(sortFunc);  | 
            ||
| 24 | }  | 
            ||
| 25 | return visibles;  | 
            ||
| 26 | };  | 
            ||
| 27 | |||
| 28 |       this.isUpgradeVisible = function(name, slot, upgrade) { | 
            ||
| 29 |         if (upgrade.tiers) { | 
            ||
| 30 |           for (let tier of upgrade.tiers) { | 
            ||
| 31 |             if (slot.generators[tier] === 0) { | 
            ||
| 32 | return false;  | 
            ||
| 33 | }  | 
            ||
| 34 | }  | 
            ||
| 35 | }  | 
            ||
| 36 | return meetDependencies(slot.upgrades, upgrade.deps) &&  | 
            ||
| 37 | meetDependencies(state.player.exotic_upgrades[slot.element], upgrade.exotic_deps) &&  | 
            ||
| 38 | meetDependencies(state.player.dark_upgrades, upgrade.dark_deps);  | 
            ||
| 39 | };  | 
            ||
| 40 | |||
| 41 |       function meetDependencies(upgrades, dependencies) { | 
            ||
| 42 |         if(!dependencies){ | 
            ||
| 43 | return true;  | 
            ||
| 44 | }  | 
            ||
| 45 |         for (let dep of dependencies) { | 
            ||
| 46 |           if (!upgrades[dep]) { | 
            ||
| 47 | return false;  | 
            ||
| 48 | }  | 
            ||
| 49 | }  | 
            ||
| 50 | return true;  | 
            ||
| 51 | }  | 
            ||
| 52 | }  | 
            ||
| 53 | ]);  | 
            ||
| 54 |